<template>
  <div class="person-detail">
    <van-nav-bar title="个人信息" left-arrow @click-left="back">
      <template #right>
        <van-icon name="share" size="18" @click="showShare = true" />
      </template>
    </van-nav-bar>
    <div class="head-pic">
      <div v-if="detail.imgFile" class="pic" :style="{backgroundImage:`url(${detail.imgFile.uriPath})`}"></div>
      <div v-if="!detail.imgFile" class="pic" ></div>
    </div>
    <div class="filed">
      <div class="item van-hairline--bottom">
        <label for>姓名</label>
        <span>{{detail.name}}</span>
      </div>
      <div class="item van-hairline--bottom">
        <label for>就职企业</label>
        <span>{{detail.empEnterprise}}</span>
      </div>
      <div class="item van-hairline--bottom">
        <label for>所属行业</label>
        <span>{{detail.industry}}</span>
      </div>
      <div class="item van-hairline--bottom">
        <label for>工作年限</label>
        <span>{{detail.workYears}}</span>
      </div>
      <div class="item van-hairline--bottom">
        <label for>联系方式</label>
        <span>{{detail.phone}}</span>
      </div>
      <div class="item van-hairline--bottom">
        <label for>服务项目</label>
        <span>{{detail.serviceItems}}</span>
      </div>
      <div class="item van-hairline--bottom">
        <label for>邮箱</label>
        <span>{{detail.email}}</span>
      </div>
      <div class="item">
        <label for>人生格言</label>
        <span>{{detail.lifeMotto}}</span>
      </div>
    </div>
    <share-person :detail="detail" v-if="showShare" @close="close"></share-person>
  </div>
</template>

<script>
import api from 'api/api'
export default {
  data () {
    return {
      showShare:false,
      detail: {}
    }
  },
  created () {
    this.getData()
  },
  methods: {
    back () {

          if(this.$route.query.share){
           this.$router.push('/home')
         }else{
           window.history.go(-1)
         }
    
     
    },
    close(){
      this.showShare = false
    },
    getData () {
      api.getEliteDetails({
        data: {
          id: this.$route.params.id
        }
      }).then(res => {
        this.detail = res.data
      })
    },
    sharefun(){

    }
  }
}
</script>

<style lang="scss">
.person-detail {
  font-size: 0.32rem;
  .head-pic {
    padding: 0.5rem;
    border-bottom: 0.2rem solid #f5f5f5;
    .pic {
      width: 2.78rem;
      height: 2.96rem;
      background-size: cover;
      background-color: #f5f5f5;
      display: block;
      margin: 0 auto;
    }
  }
  .filed {
    padding: 0 0.3rem;
    .item {
      display: flex;
      justify-content: space-between;
      align-items: top;
      padding: 0.3rem 0;
      label {
        flex: none;
        margin-right: 0.2rem;
      }
      span {
        flex: auto;
        text-align: right;
      }
    }
  }
}
</style>